import req from '../http'
// 侧边栏的全部请求
export function user(data) {
    return  req({
        url: '/member/membercontroller/getMember',
        method: 'get',
        params:data
    })
}

// 钱包
export function bag(data) {
    return  req({
        url: '/member/membercontroller/getMember',
        method: 'get',
        params:data
    })
}

//充值 微信
export function addmoney(data){
     return req({
         url:'/pay/WXPay/addMoney',
         method:'post',
         data:data
     })
}
//充值 支付宝
export function addmoney1(data){
    return req({
        url:'/pay/aliPay/addMoney1',
        method:'post',
        data:data
    })
}
// 支付
export function pay(data){
    return req({
        url:'/api/mbs/order/insertOrder',
        method:'post',
        data:data
    })
}
// 检验密码
export function checkPwd(data){
    return req({
        url:'set/UpdateMemberPassword/getOldpswd?OldPassword='+data.oldpw,
        method:'post',
        data:data
    })
}

// 修改密码
export function changePwd(data){
    // console.log(data)
    return req({
        url:'set/UpdateMemberPassword/UpdateMemberPassword?password='+data.password,
        method:'post',
        data:data
    })
}
// 找回密码
export function backPwd(data){
    // console.log(data)
    return req({
        url:'/mbs/client/BackPwd',
        method:'post',
        data:data
    })
   
}
// 完善个人资料
export function userdataFun(data){
    // console.log(data)
    return req({
        url:'/member/membercontroller/update',
        method:'post',
        data:data
    })
      
}

// 上传图片
export function uploadImg(data){
    return req({
        url:'/system/api/user/upload02',
        method:'post',
        data:data
    })   
}

// 修改图片
export function uploadImgMember(data){
    return req({
        url:'/member/membercontroller/uploadImg',
        method:'post',
        data:data
    })   
}

// 微信二维码
export function getNativeCodeUrl(data){
    return req({
        url:'/pay/WXPay/createNative',
        method:'post',
        data: data,
    })   
}
// 创建mq
export function createMQ(data){
    return req({
        url:'/pay/WXPay/createMQ',
        method:'post',
        data: data,
    })
}
// 创建mq
export function createMQ1(data){
    return req({
        url:'/order/WXOrderPay/createMQ',
        method:'post',
        data: data,
    })
}

// 微信二维码（未支付的订单）
export function getNativeCodeUrlNo(data){
    return req({
        url:'/pay/WXPay/createNative1',
        method:'post',
        data: data,
    })
}

//支付宝二维码
export function getNativeCodeUrl1(data) {
    return req({
        url:'/pay/aliPay/createNative1',
        method:'post',
        data:data,
    })
}
//支付宝二维码(未支付的订单)
export function getNativeCodeUrlAli(data) {
    return req({
        url:'/pay/aliPay/createNative2',
        method:'post',
        data:data,
    })
}

//验证是否支付（微信）
export function queryPayStatus(data){
    return req({
        url:'/pay/WXPay/queryPayStatus?id='+data.id,
        method:'post',
        data:data
    })   
}
//验证是否支付（支付宝）
export function queryPayStatus1(data){
    return req({
        url:'/pay/aliPay/queryPayStatus?id='+data.id,
        method:'post',
        data:data
    })
}


//查询订单
export function queryByMemberId(data){
    return req({
        url:'/order/member/selectByMemberId?memberId='+data.memberId +'&state='+data.state,
        method:'get'
    })   
}
//查询优惠券
export function queryByMemberCoupon(data){
    //console.log(data)
    return req({
        url:'coupon/coupon/list?memberId='+data.memberId +'&useStatus='+data.state,
        method:'get'
    })
}
//查询用户租车记录
export function queryByMemberCAr(data){
    return req({
        url:'/rent/return/returncar?id='+data.memberId +'&status='+data.state,
        method:'post'
    })
}
//查询优惠券
export function queryByMemberCoupon1(data){
    return req({
        url:'coupon/coupon/listout?memberId='+data.memberId +'&useStatus='+data.state,
        method:'get'
    })
}
//查询优惠券
export function queryByMemberCoupon2(data){
    return req({
        url:'coupon/coupon/getcoupon',
        method:'get'
    })
}
// 更新优惠券
export function updatecoupon(data){
    return req({
        url:'coupon/coupon/updateCouponout?memberId='+data.memberId+"&couponId="+data.couponId,
        method:'post',
        data:data
    })
}
// 订单二维码 微信
export function getNativeCodeUrl2(data){
    return req({
        //url:'/order/getNativeCodeUrl?preparidAmount='+data.preparidAmount+"&memberId="+data.memberId,
        url:'/order/WXOrderPay/createNative',
        method:'post',
        data: data
    })   
}
// 订单二维码 支付宝
export function getNativeCodeUrl3(data){
    //console.log(data)
    return req({
        //url:'/order/getNativeCodeUrl?preparidAmount='+data.preparidAmount+"&memberId="+data.memberId,
        url:'/order/ALiOrderPay/createALiNative',
        method:'post',
        data: data
    })
}
//验证是否支付（微信）
export function queryPayStatus2(data){
    return req({
        url:'/order/WXOrderPay/queryOrderStatus',
        method:'post',
        data:data
    })   
}
//验证是否支付（支付宝）
export function queryPayStatus3(data){
    console.log(data)
    return req({
        url:'/order/ALiOrderPay/queryPayStatus1',
        method:'post',
        data:data
    })
}
export function updateAllState(data){
    return req({
        url:'/order/WXOrderPay/updateAllState',
        method:'post',
        data:data
    })
}
export function updateAllState1(data){
    return req({
        url:'/order/ALiOrderPay/updateStatus',
        method:'post',
        data:data
    })
}

//下单
export function addorder(data){
    return req({
        url:'/order/member/insert',
        method:'post',
        data:data
    })
}
//下单寻找优惠卷
export function useCoupon(data){
    return req({
        url:'/member/api/couponHistory/selectBymemberId?memberId='+data.memberId+'&shopId='+data.shopId,
        method:'post'
    })
}
//用户金额下单
export function useAmount(data){
    return req({
        url:'/order/member/insert',
        method:'post',
        data:data
    })
}
//用户取消下单
export function closeOrder(data){
    return req({
        url:'/order/member/update',
        method:'post',
        data:data
    })
}

//查询充值订单
export function queryAccountOrderByMemberId(data){
    return req({
        url:'/order/member/findByMemberId',
        method:'post',
        data: data
    })
}

//充值订单继续支付或取消支付
export function accountOrderCancel(data){
    return req({
        url: '/order/member/updateAccountOrder',
        method: 'post',
        data: data
    })
}
